問題描述
ListView中的序列號列 (Serial number Column in ListView)
Possible Duplicate: How to display row numbers in a ListView?
Currently I am using a sortable listview Which is bind to DataTable, I have a Serial number column which is auto incremented and displayed, Our requirement is when we sort other columns this column shall remain constant and show row numbers in series as in Excel.
I am planning to have a stack panel beside listview and adding Textboxes to stackpanel dynamically and removing serial number column from listview. please suggest me if there is any better way to do.
Thanks in advance.
Additional Info: Following Code is used to augment listview to provide sorting http://marlongrech.wordpress.com/2008/04/20/part1‑avaloncontrolslibrary‑datagridview/
‑‑‑‑‑
參考解法
方法 1:
Use a multi binding in your column to get the index of the current item. I liked this question so much i did a little project to demonstrate. there are probably better/other ways, but then again there always is :)
From this Site(where i post my test projects) download ListViewWithRowNumbers.zip
enjoy!
(by Nadeem Shukoor、Aran Mulholland)